﻿using System.Collections.Generic;
using BlawkayEngine;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;

namespace BlawkayHockey
{
    public class Goal
    {

        public Goal(Game oGame, Vector3 oPosition, string oImagePath, float oHeight, float oWidth, float oLength)
        {
            // Top
            Texture2D oTexture = oGame.Content.Load<Texture2D>(oImagePath);
            _Net = new List<Quad>();
            Quad q;

            q = new Quad(oGame, oTexture, null, oPosition, new Vector3(0, -0.2f + oHeight * 0.5f, -oWidth * 0.5f),
                VectorHelper.GLOBAL_BACKWARD, VectorHelper.GLOBAL_UP, oLength, oHeight, false);
            q.Effect.SpecularColor = new Vector3(0.325f, 0.325f, 0.325f);
            _Net.Add(q);

            q = new Quad(oGame, oTexture, null, oPosition, new Vector3(0, -0.2f + oHeight * 0.5f, oWidth * 0.5f),
                -VectorHelper.GLOBAL_BACKWARD, VectorHelper.GLOBAL_UP, oLength, oHeight, false);
            q.Effect.SpecularColor = new Vector3(0.325f, 0.325f, 0.325f);
            _Net.Add(q);

            q = new Quad(oGame, oTexture, null, oPosition, new Vector3(0, -0.2f + oHeight, 0),
                -VectorHelper.GLOBAL_UP, VectorHelper.GLOBAL_RIGHT, oWidth, oHeight, false);
            q.Effect.SpecularColor = new Vector3(0.325f, 0.325f, 0.325f);
            _Net.Add(q);
        }

        public void Update(Camera oCamera)
        {
            foreach (Quad q in _Net)
                q.Update(oCamera);
        }

        public void DrawOpaque(Game oGame)
        {
            foreach (Quad q in _Net)
                q.Draw(oGame);
        }

        List<Quad> _Net;

    }

}
